<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page language="java" import="com.br.dao.PrivilegioDao"%>    
<%@ page language="java" import="com.br.model.Privilegio"%>
<%@ page language="java" import="com.br.utilitarios.funcoes"%>
<%@ page language="java" import="java.util.List"%>
<%@ page language="java" import="java.util.ArrayList"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="shortcut icon" href="resources/if.ico"> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>GesDoc - Gestao Documental</title>
<style type="text/css"> 
@import url(styles.css)
</style>
<link rel="stylesheet" href="style.css" type="text/css" media="screen, projection" />
<!--[if lte IE 6]><link rel="stylesheet" href="style_ie.css" type="text/css" media="screen, projection" /><![endif]-->      
    <script src="sliding/jquery.js" type="text/javascript"></script>
	<script src="sliding/general.js" type="text/javascript"></script>    

	<link href="windows8/Style/Interacao.css" rel="stylesheet" type="text/css" />
    <link href="windows8/Style/jq-metro.css" rel="stylesheet" type="text/css" />
    <script src="windows8/Style/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="windows8/Script/jquery.metro-btn.js" type="text/javascript"></script>
    <% funcoes function = new funcoes(); %>
    <%=function.getJQueryAdm()%>
</head>
<body>
<%
 //Objetos 
 
 
 //Variaveis
 String vCodGrupo    = request.getParameter("id");
 String           vCodUsuario	   = session.getAttribute("codusuario").toString();
 
 session.setAttribute("codusuario",vCodUsuario);
 	
 session.setAttribute("codgrupo",vCodGrupo);
 session.setAttribute("operacao","alterar");
 
 String vUsuario     = session.getAttribute("user").toString();
 String vSenha       = session.getAttribute("pass").toString();
 String vSitAdm      = session.getAttribute("Administrador").toString();  
 
 session.setAttribute("user",vUsuario);
 session.setAttribute("pass",vSenha);
 session.setAttribute("Administrador",vSitAdm); 
%>
 <div id="paginatop">
 	<p align="left"><img src="resources/gesdoc.png" ></p>
 </div>
 <div id="paginatop2">
 	<a href="index.jsp"><img src="resources/logoff.png"></a>
 </div>
 
 <div id="menulateral">
  <div id="metrobuttons" class="metro-panel"></div>
  <div id="metrobuttons2" class="metro-panel"></div>
 </div>

<%	 
     	//Variaveis
		String vCodEmp              = request.getParameter("id");
		String vCodUser             = request.getParameter("id2");
		String vCodMenu             = request.getParameter("id3");
	    List<String> vCampos        = new ArrayList<String>();
	    List<String> vValores       = new ArrayList<String>();
	    List<Privilegio> listaPrivi = new ArrayList<Privilegio>();
		
		//Objetos
		Privilegio    priv    = new Privilegio();
		PrivilegioDao privDao = new PrivilegioDao();
 	 	
		
		vCampos.clear();
		vCampos.add("COD_EMPRESA");
		vCampos.add("COD_USUARIO");
		vCampos.add("COD_MENU");
		
		vValores.clear();
		vValores.add(vCodEmp);
		vValores.add(vCodUser);
		vValores.add(vCodMenu);
		
		listaPrivi = privDao.consulta(vCampos, vValores);
 	 	//Operacoes
 	 	priv = listaPrivi.get(0);
 	 	
 	 	try{
 	 		privDao.remover(priv);
%>  
     		<div id="centrallogin">
	 			<p align="center"><img heigth="110%" width="110%" src="resources/gesdoc02.png" ></p>
	 			<p align="center"><strong>&nbsp;&nbsp; Privilegio removido com sucesso !</strong>
 	 			<h2><center><strong><a HREF="control.jsp">Voltar</a></strong></center></h2></p>
 			</div>
<% 	
 		}catch(Exception e){
	 		e.printStackTrace();
%>  
     		<div id="centrallogin">
	 			<p align="center"><img heigth="110%" width="110%" src="resources/gesdoc02.png" ></p>
	 			<p align="center"><strong>&nbsp;&nbsp; Erro ao remover Privilegio</strong>
 	 			<h2><center><strong><a HREF="control.jsp">Voltar</a></strong></center></h2></p>
 			</div>
<%}%> 
</body>
</html>